package org.springblade.modules.mes.unit.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springblade.modules.mes.check.insert;
import org.springblade.modules.mes.check.update;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 计量单位
 * @author zhanglianchao
 */
@Data
@TableName("bd_unit")
@EqualsAndHashCode(callSuper = true)
public class UnitEntity extends TenantEntity {
    private static final long serialVersionUID = -6410684149026088508L;

    @ApiModelProperty(value = "单位编码")
    @NotBlank(message = "单位编码不可为空",groups = {insert.class, update.class})
    private String code;

    @ApiModelProperty(value = "单位名称")
    @NotBlank(message = "单位名称不可为空",groups = {insert.class,update.class})
    private String name;

    @ApiModelProperty(value = "数值精度")
    @NotNull(message = "数值精度不可为空！")
    @Min(value = 1,message = "数值精度不可小于1",groups = {insert.class,update.class})
    @Max(value = 5,message = "数值精度不可大于5",groups = {insert.class,update.class})
    private Integer accuracy;

    @ApiModelProperty(value = "是否有效")
    private Boolean isEnable;

    @ApiModelProperty(value = "是否默认 0:否 1:是")
    private Integer isDefault;

    @ApiModelProperty(value ="更新人名称")
    private String updateUserName;

    @ApiModelProperty(value ="创建人名称")
    private String createUserName;
    @ApiModelProperty(value ="类型")
    private String unitType;
}
